package com.simon.hse;

import android.app.Application;
import android.content.Context;

import com.android.tony.defenselib.DefenseCrashApplication;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator;
import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator;
import com.scwang.smartrefresh.layout.api.RefreshFooter;
import com.scwang.smartrefresh.layout.api.RefreshHeader;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
import com.scwang.smartrefresh.layout.header.ClassicsHeader;
import com.simon.hse.http.entity.ContractorCompanyOutput;
import com.simon.hse.http.entity.ContractorPersonOutput;
import com.simon.hse.http.entity.DropDownOutput;
import com.simon.hse.http.entity.TrainCourseOutput;
import com.simon.hse.http.entity.TrainPersonOutput;

import org.xutils.x;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

//public class MyApplication extends DefenseCrashApplication {
public class MyApplication extends Application {

    private static MyApplication mContext;
    public List<ContractorCompanyOutput.DataBean.PageDataBean> mListContractorCompany = new ArrayList<>();// 供应商
    public List<TrainCourseOutput.DataBean.PageDataBean> mListTrainCourse = new ArrayList<>();// 培训课程
    public List<TrainPersonOutput.DataBean.PageDataBean> mListTrainPerson = new ArrayList<>();// 培训人
    public List<ContractorPersonOutput.DataBean.PageDataBean> mListParticipant = new ArrayList<>();// 参与人
    public Map<String, String> mMapExamin = new HashMap<>();// 考题id与答案
    public List<DropDownOutput.DataBean.DataDicListBean.ValueBean> mRiskClassList = new ArrayList<>();// 风险类别
    public List<DropDownOutput.DataBean.DataDicListBean.ValueBean> mRiskLevelList = new ArrayList<>();// 风险级别
    public List<DropDownOutput.DataBean.DataDicListBean.ValueBean> mDangerDepartList = new ArrayList<>();// 部门
    public List<DropDownOutput.DataBean.DataDicListBean.ValueBean> mDangerDaysList = new ArrayList<>();// 班次
    public List<DropDownOutput.DataBean.DataDicListBean.ValueBean> mDangerAreasList = new ArrayList<>();// 区域
    public List<DropDownOutput.DataBean.DataDicListBean.ValueBean> mDangerRatesList = new ArrayList<>();// 频率
    public List<DropDownOutput.DataBean.DataDicListBean.ValueBean> mDangerStationsList = new ArrayList<>();// 岗位
    public List<DropDownOutput.DataBean.DataDicListBean.ValueBean> mDangerStandardsList = new ArrayList<>();// 标准类型 检查类别
    public List<DropDownOutput.DataBean.DataDicListBean.ValueBean> mDangerConditionsList = new ArrayList<>();// 排查情况
    public List<DropDownOutput.DataBean.DataDicListBean.ValueBean> mDangerClassifyList = new ArrayList<>();// 隐患分类
    public List<DropDownOutput.DataBean.DataDicListBean.ValueBean> mDangerLevelList = new ArrayList<>();// 隐患等级
    public List<DropDownOutput.DataBean.DataDicListBean.ValueBean> mDangerStateList = new ArrayList<>();// 整改状态
    public List<DropDownOutput.DataBean.DataDicListBean.ValueBean> mFactoryList = new ArrayList<>();// 工厂
    public List<String> mSafeQureyStateList = new ArrayList<>();// 查询状态
    public List<String> mSafeApprovalStateList = new ArrayList<>();// 审批查询状态
    public List<String> mSafeCancelApprovalStateList = new ArrayList<>();// 取消审批查询状态
    public List<String> mJSACancelApprovalStateList = new ArrayList<>();// JSA取消审批查询状态
    public List<String> mSafeWorkUnitList = new ArrayList<>();// 作业单位
    public List<String> mSafeWorkAreaList = new ArrayList<>();// 工作区域
    public List<String> mSafeWorkPlaceList = new ArrayList<>();// 工作地点
    public List<String> mSafePersonInChargeList = new ArrayList<>();// 作业负责人
    public List<String> mSafeOperatorList = new ArrayList<>();// 作业人
    public List<String> mSafeGuardianList = new ArrayList<>();// 监护人
    public List<String> mSafeDepartmentList = new ArrayList<>();// 部门
    public List<String> mSafeApproverList = new ArrayList<>();// 审批人
    public List<String> mSafeWorkShopList = new ArrayList<>();// 车间负责人
    public List<String> mSafeHazardousEnergyList = new ArrayList<>();// 危险能量
    public List<String> mSafeIsolationMethodList = new ArrayList<>();// 隔离方法
    public List<String> mSafeNullList = new ArrayList<>();//无数据

    public static MyApplication getInstance() {
        return mContext;
    }

    @Override
    public void onCreate() {
        super.onCreate();

        mContext = this;
        x.Ext.init(this);
        setCustomRefreshLayout();
        initList();
    }

    private void initList() {
        mSafeQureyStateList.add("全部");
        mSafeQureyStateList.add("暂存");
        mSafeQureyStateList.add("待确认");
        mSafeQureyStateList.add("待审批");
        mSafeQureyStateList.add("有效");
        mSafeQureyStateList.add("超期");
        mSafeQureyStateList.add("关闭");
        mSafeQureyStateList.add("取消");

        mSafeCancelApprovalStateList.add("全部");
        mSafeCancelApprovalStateList.add("待审批");
        mSafeCancelApprovalStateList.add("取消");

        mSafeWorkUnitList.add("全部");

        mSafeWorkAreaList.add("全部");
        mSafeWorkAreaList.add("RT车间");
        mSafeWorkAreaList.add("XT车间");

        mSafePersonInChargeList.add("全部");
        mSafePersonInChargeList.add("张三");
        mSafePersonInChargeList.add("张二");

        mSafeApprovalStateList.add("全部");
        mSafeApprovalStateList.add("未生效");
        mSafeApprovalStateList.add("生效中");
        mSafeApprovalStateList.add("已取消");
        mSafeApprovalStateList.add("已关闭");

        mJSACancelApprovalStateList.add("全部");
        mJSACancelApprovalStateList.add("已审批");
        mJSACancelApprovalStateList.add("未审批");

        mSafeWorkPlaceList.add("全部");

        mSafeGuardianList.add("全部");

        mSafeDepartmentList.add("全部");

        mSafeApproverList.add("全部");

        mSafeWorkShopList.add("全部");

        mSafeOperatorList.add("全部");

        mSafeNullList.add("全部");

        mSafeHazardousEnergyList.add("机械能");
        mSafeHazardousEnergyList.add("电能");
        mSafeHazardousEnergyList.add("化学能");
        mSafeHazardousEnergyList.add("热能");
        mSafeHazardousEnergyList.add("辐射能");

        mSafeIsolationMethodList.add("移除管线加盲板");
        mSafeIsolationMethodList.add("双切断加导淋");
        mSafeIsolationMethodList.add("关闭阀门");
        mSafeIsolationMethodList.add("切断电源");
        mSafeIsolationMethodList.add("其他");
    }

    private void setCustomRefreshLayout() {
        //设置全局的Header构建器
        SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() {
            @Override
            public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) {
                layout.setPrimaryColorsId(R.color.title_color, android.R.color.white);//全局设置主题颜色
                return new ClassicsHeader(context);//.setTimeFormat(new DynamicTimeFormat("更新于 %s"));//指定为经典Header，默认是 贝塞尔雷达Header
            }
        });
        //设置全局的Footer构建器
        SmartRefreshLayout.setDefaultRefreshFooterCreator(new DefaultRefreshFooterCreator() {
            @Override
            public RefreshFooter createRefreshFooter(Context context, RefreshLayout layout) {
                //指定为经典Footer，默认是 BallPulseFooter
                return new ClassicsFooter(context).setDrawableSize(20);
            }
        });
    }
}
